package org.pcorp.battlespace.construction.ui.sub;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;

import org.pcorp.battlespace.construction.modele.VaisseauCstr;
import org.pcorp.battlespace.construction.ui.Principal;
import org.pcorp.battlespace.construction.ui.tools.ConstanteUI;
import org.pcorp.battlespace.construction.ui.tools.GeneralRuleUi;

public class FooterUi extends GeneralRuleUi {
	private static final long serialVersionUID = 1588749272407121813L;
	private JLabel masseDspLbl;
	private static final int HAUTEUR = 100;
	
	public FooterUi(Principal p) {
		super(p);
		masseDspLbl = new JLabel("000'000 UM");
		setMaximumSize(new Dimension(ConstanteUI.WIDTH, HAUTEUR));
		setLayout(new GridBagLayout());

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.anchor = GridBagConstraints.LAST_LINE_END;
		gbc.gridx = gbc.gridy = 0;
		gbc.gridwidth = gbc.gridheight = 1;
		gbc.weightx = gbc.weighty = 1;
		gbc.insets = new Insets(10, 10, 10, 10);
		add(masseDspLbl, gbc);
		
		/*JButton bouton = new JButton("TESTEUR");
		bouton.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				SelectArmModal zd = new SelectArmModal(null);
				zd.setVisible(true);
			}
			
		});
		
		gbc.gridy = 1;
		add(bouton, gbc);*/
	}

	public JLabel getMasseDspLbl() {
		return masseDspLbl;
	}

	public void setMasseDspLbl(JLabel masseDspLbl) {
		this.masseDspLbl = masseDspLbl;
	}

	@Override
	public void updateDisplay(VaisseauCstr vaiss) {
		masseDspLbl.setText(getLongText(vaiss.getMasseRestante()).concat(" UM"));
	}

	@Override
	public void updateModel(VaisseauCstr vaiss) {
		// TODO Auto-generated method stub
		
	}
}
